package com.button.controller;

import com.button.domain.vo.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@Slf4j
@Validated
@Api(tags = "测试API")
@RequestMapping(value = "/api/test", produces = "application/json")
public class TestController {

    @GetMapping("/get-list")
    @ApiOperation(value = "测试get", notes = "作者:zh")
    public String getList(HttpServletRequest request) {
        log.info("测试");
        return "SUCCESS";
    }


    @GetMapping("/get-token")
    @ApiOperation(value = "测试get(需要token)", notes = "作者:zh")
    public String getListToken(HttpServletRequest request) {
        log.info("测试");
        return "SUCCESS-TOKEN";
    }

    @GetMapping("/get-user")
    @ApiOperation(value = "测试", notes = "作者:zh")
    public User getUser(HttpServletRequest request) {
        User user = new User();
        user.setName("张三");
        user.setPassword("123456789");
        return user;
    }
}
